# -*- coding:utf-8 -*-

from com.mat.rpa.utils.globalConstants import GlobalConstants
from com.mat.rpa.views.workWindow.leftPanel.directiveTree import treeItem
from . import textOperationConstants


class TextOperationSubDirectiveTree(treeItem.TreeItemWithID):
    def __init__(self, parent):
        super(TextOperationSubDirectiveTree, self).__init__(parent)
        self.createTextOperationTreeNode()

    def createTextOperationTreeNode(self):
        self.nodeType = GlobalConstants.treeBranchType
        self.directiveType = "textOperation"
        self.setText(0,"文本操作")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.extractingContentFromTextDirective, "从文本中提取内容")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.gettingTextLengthDirective, "获取文本长度")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.appendingNewTextDirective, "追加新文本")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.interceptingPartOfTextDirective, "截取一段文本")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.supplementingTextToSpecificLengthDirective, "补齐文本至指定长度")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.strippingBlanksAtTwoEndsOfTextDirective, "删除文本两端空格")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.changingTheCaseOfTextDirective, "改变文本大小写")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.aggregatingListToTextDirective, "将列表聚合成文本")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.splittingTextToListDirective, "将文本分割成列表")
        self.createTreeNode(GlobalConstants.treeLeafType,
                            self, textOperationConstants.TextOperationConstants.textReplacementDirective, "文本替换")